package com.magicmovie.api.service;

import com.magicmovie.api.service.impl.CustomerServiceImpl;
import com.magicmovie.entity.Customer;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "service",fallback = CustomerServiceImpl.class)
public interface CustomerService {
    @RequestMapping(value = "/customer/findByUsername",method = RequestMethod.GET)
    Customer findByUsername(@RequestParam("username")String username);

    @RequestMapping(value = "/customer/register",method = RequestMethod.GET)
    void register(@RequestParam("username") String username,@RequestParam("password") String password);

    @RequestMapping(value = "/customer/createToken",method = RequestMethod.POST)
    String createToken(@RequestBody Customer customer);

    @RequestMapping(value = "/customer/findByToken",method = RequestMethod.GET)
    Customer findByToken(@RequestParam("token") String token);

    @RequestMapping(value = "/customer/logout",method = RequestMethod.POST)
    void logout(@RequestBody Customer customer);

    @RequestMapping(value = "/customer/updateByPrimaryKeySelective",method = RequestMethod.POST)
    void updateByPrimaryKeySelective(@RequestBody Customer customer);
}
